<!--
 * @Descripttion: (/RealTimeDustData)
 * @version: (1.0)
 * @Author: (admin)
 * @Date: (2024-11-08)
 * @LastEditors: (admin)
 * @LastEditTime: (2024-11-08)
-->
<template>
  <div class="app-container">
    <!-- :model属性用于表单验证使用 比如下面的el-form-item 的 prop属性用于对表单值进行验证操作 -->
   <el-form :model="queryParams" size="small" label-position="right" inline ref="queryForm" :label-width="labelWidth"
      v-show="showSearch" @submit.native.prevent>
      <!--  <el-form-item label="主机名称" prop="machineName">
        <el-input v-model="queryParams.machineName" placeholder="请输入主机名称" />
      </el-form-item>
        <el-form-item label="主机地址" prop="location">
          <el-input v-model="queryParams.location" placeholder="请输入主机地址" />
        </el-form-item>
        <el-form-item label="主机场景" prop="machineSence">
          <el-input v-model="queryParams.machineSence" placeholder="请输入主机场景" />
        </el-form-item>
    <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item> -->
    </el-form>
    <!-- 数据区域 -->
    <el-table :data="dataList" v-loading="loading" ref="table" border highlight-current-row @sort-change="sortChange"
      @selection-change="handleSelectionChange">
      <el-table-column prop="sno" label="传感器编号" align="center" />
      <el-table-column prop="sname" label="传感器名称" align="center" />
      <!-- <el-table-column prop="MachineSence" label="主机场景" align="center"  /> -->
      <el-table-column prop="swz" label="主机地址" align="center"  />
      <el-table-column prop="pw" label="喷雾状态" align="center" />
      <!-- <el-table-column prop="temperValue" label="温度" align="center" :show-overflow-tooltip="true" width="140px" />
      <el-table-column prop="pressValue" label="压力" align="center" :show-overflow-tooltip="true" width="140px" />
      <el-table-column prop="humValue" label="湿度" align="center" :show-overflow-tooltip="true" width="140px" />
      <el-table-column prop="dustValue" label="降尘浓度" align="center" :show-overflow-tooltip="true" width="140px" /> -->
      <!-- <el-table-column prop="qTAlarm" label="报警状态" align="center" :show-overflow-tooltip="true" width="140px" /> -->
      <el-table-column prop="saveTime" label="刷新时间" align="center" :show-overflow-tooltip="true" width="220px" />
    </el-table>
    <pagination class="mt10" background :total="total" :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize" @pagination="getList" />
  </div>
</template>
<script>
import {
  listRealTimeDustData,
  getRealTimeDustData,
} from '@/api/dust/realTimeDustData.js';

export default {
  name: "realtimedustdata",
  data() {
    return {
      labelWidth: "100px",
      formLabelWidth: "100px",
      // 选中monitorDataID数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 遮罩层
      loading: false,
      // 显示搜索条件
      showSearch: true,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        location: "",
        machineName: "",
        machineSence: "",
      },
      // 弹出层标题
      title: "",
      // 操作类型 1、add 2、edit
      opertype: 0,
      // 是否显示弹出层
      open: false,

      // 数据列表
      dataList: [],
      // 总记录数
      total: 0,
      // 提交按钮是否显示
      btnSubmitVisible: true,
      // 表单校验
      rules: {
      },
    };
  },
  created() {
    // 列表数据查询
    this.getList();

    var dictParams = [
    ];
  },
  methods: {
    // 查询数据
    getList() {
      this.loading = true;
      listRealTimeDustData(this.queryParams).then(res => {
        if (res.code == 200) {
          this.dataList = res.data.result;
          this.total = res.data.totalNum;
          this.loading = false;
        }
      })
    },

    // 重置查询操作
    resetQuery() {
      this.timeRange = [];
      this.resetForm("queryForm");
      this.handleQuery();
    },

    /** 搜索按钮操作 */
    handleQuery() {
      console.log(this.queryParams);
      this.queryParams.pageNum = 1;
      this.getList();
    },
  },
};
</script>